import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:life_service/color/hex.dart';
import 'package:life_service/extensions/ex_widget.dart';
import 'package:life_service/route/index.dart';
import 'package:life_service/utils/styles.dart';
import 'package:life_service/views/mine/controller.dart';

class MineUsedInfoPage extends GetView<MineUsedInfoController> {
  const MineUsedInfoPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: PreferredSize(
        preferredSize: Size.fromHeight(Get.mediaQuery.padding.top + 44),
        child: AnnotatedRegion<SystemUiOverlayStyle>(
          value: SystemUiOverlayStyle.dark,
          child: Container(
            padding: Get.mediaQuery.padding,
            alignment: Alignment.centerLeft,
            decoration: BoxDecoration(
              color: Colors.white,
              border: Border(
                bottom: BorderSide(
                  color: HexColor(HexColor.colorF2f2),
                ),
              ),
            ),
            child: TextButton(
              onPressed: Get.back,
              child: Text.rich(
                TextSpan(
                  children: [
                    const WidgetSpan(
                      child: Icon(
                        CupertinoIcons.chevron_back,
                        size: 18,
                        color: Colors.black,
                      ),
                    ),
                    TextSpan(
                      text: ' 常用信息',
                      style: StylesUtils.customTextStyle(
                        fontSize: StylesUtils.fontSize16,
                        color: HexColor.color3333,
                      ),
                    ),
                  ],
                ),
              ),
            ),
          ),
        ),
      ),
      body: SingleChildScrollView(
        child: Column(
          children: [
            Container(
              alignment: Alignment.center,
              margin: const EdgeInsets.only(top: 15),
              child: Container(
                width: 335,
                padding:
                    const EdgeInsets.symmetric(vertical: 15, horizontal: 20),
                decoration: BoxDecoration(
                  color: HexColor.rgba(255, 98, 98, 0.0470588235294118),
                  borderRadius: BorderRadius.circular(8),
                  border: Border.all(
                    color: HexColor(HexColor.colorFf62),
                  ),
                ),
                child: Column(
                  children: [
                    Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Wrap(
                          spacing: 20,
                          crossAxisAlignment: WrapCrossAlignment.center,
                          alignment: WrapAlignment.start,
                          children: [
                            Text(
                              '白居易',
                              style: StylesUtils.customTextStyle(
                                fontSize: StylesUtils.fontSize16,
                                color: HexColor.color3333,
                                fontWeight: FontWeight.w700,
                              ),
                            ),
                            Text(
                              '男   32岁',
                              style: StylesUtils.customTextStyle(
                                color: HexColor.color3333,
                              ),
                            ),
                          ],
                        ),
                        Icon(
                          CupertinoIcons.clear_fill,
                          size: 20,
                          color: HexColor(HexColor.colorFf62),
                        ),
                      ],
                    ),
                    Padding(
                      padding: const EdgeInsets.only(top: 15),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text(
                            '410***********4038',
                            style: StylesUtils.customTextStyle(
                              color: HexColor.color3333,
                            ),
                          ),
                          Text(
                            '188*****236',
                            style: StylesUtils.customTextStyle(
                              color: HexColor.color3333,
                            ),
                          )
                        ],
                      ),
                    )
                  ],
                ),
              ),
            ),
            Container(
              alignment: Alignment.center,
              margin: const EdgeInsets.only(top: 15),
              child: DottedBorder(
                dashPattern: const [8, 4],
                strokeWidth: 1,
                color: HexColor(HexColor.colorF2f2),
                child: SizedBox(
                  height: 96,
                  width: 335,
                  child: Column(
                    children: [
                      Container(
                        margin: const EdgeInsets.only(top: 20, bottom: 15),
                        alignment: Alignment.center,
                        child: Icon(
                          CupertinoIcons.plus,
                          size: 30,
                          color: HexColor(HexColor.color9999),
                        ),
                      ),
                      Center(
                        child: Text(
                          '新增常用旅客',
                          style: StylesUtils.customTextStyle(
                            color: HexColor.color9999,
                          ),
                        ),
                      ),
                    ],
                  ),
                ).onTap(() {
                  Get.toNamed(Routes.mineUsedAdd);
                }),
              ),
            )
          ],
        ),
      ),
    );
  }
}
